


var cir1, cir2,cir3,cir4,ds1,ds2,ds3;

$(document).ready(function() {
	
	
	var paper = Raphael(document.getElementById("arrow_svg"), 1200, 768);
	
	var points1 = [[150,170],[360,320],[450,220]];
	var points2 = [[450,220],[450,20],[1500,20]];
	var points3 = [[450,220],[1500,220]];
	var points4 = [[450,220],[450,420],[1500,420]];
	
	cir1 = new Circuit(paper, points1, 'large');
	cir2 = new Circuit(paper, points2, 'large');
	cir3 = new Circuit(paper, points3, 'large');
	cir4 = new Circuit(paper, points4, 'large');
	cir1.delay = cir2.delay = cir3.delay = cir4.delay = cir1.circuitLength*2;
	cir1.run(cir1.delay);
	cir2.run(cir1.delay);
	cir3.run(cir1.delay);
	cir4.run(cir1.delay);
	var sh = cir1.getSwitchHandle();
	//paper.circle(sh[0],sh[1],30);
	sh = cir2.getSwitchHandle();
	//paper.circle(sh[0],sh[1],30);
	
	/*$("input#toggle").change( function() {
		cir1.toggleState();
		cir2.toggleState();
	});*/
	
	
	
	
	/*$("#switch2_svg").change( function() {
		
	});*/
	//ds1 = new DeviceSound(document.getElementById("appliance1"),'ds1Player','vacuumcleaner');
	//ds2 = new DeviceSound(document.getElementById("appliance2"),'ds2Player','hairdryer');
	//ds3 = new DeviceSound(document.getElementById("appliance3"),'ds3Player','dishwasher');
	
});




function switch1Toggle(bool)
	{
		cir1.setState(bool);
		if (!bool)
		{
			cir2.setState(false);
			cir3.setState(false);
			cir4.setState(false);
			
		}
	}

	function switch2Toggle(bool)
	{
		if (bool)
		{
			//ds1.turnOn();
		}
		else
		{
			//ds1.turnOff();
		}
		cir2.setState(bool);
		
	}

	function switch3Toggle(bool)
	{
		if (bool)
		{
			//ds2.turnOn();
		}
		else
		{
			//ds2.turnOff();
		}
		cir3.setState(bool);
		
	}

	function switch4Toggle(bool)
	{
		if (bool)
		{
			//ds3.turnOn();
		}
		else
		{
			//ds3.turnOff();
		}
		cir4.setState(bool);
		
	}